<template>
    <el-dialog title="案件信息" :visible.sync="info.open" width="65%" append-to-body :before-close="closeDelDialog">
      <div class="headerInfoButton">
        <el-button type="success" plain  @click="onInfoTap(1)">备考表预览</el-button>
        <el-button type="warning" plain  @click="onInfoTap(2)">电子文件归档登记表预览</el-button>
        <el-button type="primary" plain  @click="onInfoTap(3)">卷内目录预览</el-button>
        <el-button type="info" plain  @click="onInfoTap(4)">卷皮预览</el-button>
      </div>
      <el-tabs v-model="activeName" @tab-click="handleClick" style="margin: 1%" type="border-card">
        <el-tab-pane label="信息包头" name="Header">
          <el-form ref="header" :model="header" label-width="120px">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="移交编号">
                  <el-tooltip class="item" effect="light" :content="header.YJBH" :disabled="header.YJBH == null" placement="bottom-start">
                    <el-input v-model="header.YJBH" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="版本号">
                  <el-tooltip class="item" effect="light" :content="header.BBH" :disabled="header.BBH == null" placement="bottom-start">
                    <el-input v-model="header.BBH" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="检察院名称">
                  <el-tooltip class="item" effect="light" :content="header.JCYMC" :disabled="header.JCYMC == null" placement="bottom-start">
                    <el-input v-model="header.JCYMC" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检察院代码">
                  <el-tooltip class="item" effect="light" :content="header.JCYDM" :disabled="header.JCYDM == null" placement="bottom-start">
                    <el-input v-model="header.JCYDM" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="档案馆名称">
                  <el-tooltip class="item" effect="light" :content="header.DAGMC" :disabled="header.DAGMC == null" placement="bottom-start">
                    <el-input v-model="header.DAGMC" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="档案馆代码">
                  <el-tooltip class="item" effect="light" :content="header.DAGDM" :disabled="header.DAGDM == null" placement="bottom-start">
                    <el-input v-model="header.DAGDM" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="数字摘要算法">
                  <el-tooltip class="item" effect="light" :content="header.SZZYSF" :disabled="header.SZZYSF == null" placement="bottom-start">
                    <el-input v-model="header.SZZYSF" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="数字摘要值">
                  <el-tooltip class="item" effect="light" :content="header.SZZYZ" :disabled="header.SZZYZ == null" placement="bottom-start">
                    <el-input v-model="header.SZZYZ" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="交换类型">
                  <el-tooltip class="item" effect="light" :content="header.JHLX" :disabled="header.JHLX == null" placement="bottom-start">
                    <el-input v-model="header.JHLX" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>

        <el-tab-pane label="当事人信息" name="Party">
          <el-collapse v-model="partyName" accordion>
            <el-collapse-item v-for="(item, index) in party" :name="index" :key="index">
              <template slot="title">
                当事人/单位：{{item.DSRXM}}
              </template>
              <el-form ref="item" :model="item" label-width="120px">
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="当事人类型">
                      <el-tooltip class="item" effect="light" :content="item.DSRLX" :disabled="item.DSRLX == null" placement="bottom-start">
                        <el-input v-model="item.DSRLX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="法定代表人">
                      <el-tooltip class="item" effect="light" :content="item.FDDBR" :disabled="item.FDDBR == null" placement="bottom-start">
                        <el-input v-model="item.FDDBR" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="证件类型">
                      <el-tooltip class="item" effect="light" :content="item.ZJLX" :disabled="item.ZJLX == null" placement="bottom-start">
                        <el-input v-model="item.ZJLX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="证件号码">
                      <el-tooltip class="item" effect="light" :content="item.ZJHM" :disabled="item.ZJHM == null" placement="bottom-start">
                        <el-input v-model="item.ZJHM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="性别">
                      <el-tooltip class="item" effect="light" :content="item.XB" :disabled="item.XB == null" placement="bottom-start">
                        <el-input v-model="item.XB" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="出生年月">
                      <el-tooltip class="item" effect="light" :content="item.CSNY" :disabled="item.CSNY == null" placement="bottom-start">
                        <el-input v-model="item.CSNY" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="民族">
                      <el-tooltip class="item" effect="light" :content="item.MZ" :disabled="item.MZ == null" placement="bottom-start">
                        <el-input v-model="item.MZ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="国籍">
                      <el-tooltip class="item" effect="light" :content="item.GJ" :disabled="item.GJ == null" placement="bottom-start">
                        <el-input v-model="item.GJ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="户籍所在地">
                      <el-tooltip class="item" effect="light" :content="item.HJSZD" :disabled="item.HJSZD == null" placement="bottom-start">
                        <el-input v-model="item.HJSZD" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-collapse-item>
          </el-collapse>
        </el-tab-pane>

        <el-tab-pane label="案件信息" name="Case">
          <el-tabs v-model="caseName" @tab-click="handleCaseClick">
            <el-tab-pane label="审查起诉案件信息" name="SCQS">
              <ExamineProsecute v-if="caseName == 'SCQS'" ref="scqsRef" :folderId="folderId"></ExamineProsecute>
            </el-tab-pane>
            <el-tab-pane label="审判活动监督情况" name="SBHD">
              <el-form ref="sbhd" :model="sbhd" label-width="150px">
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="具体违法单位名称">
                      <el-tooltip class="item" effect="light" :content="sbhd.JTWFDWMC" :disabled="sbhd.JTWFDWMC == null" placement="bottom-start">
                        <el-input v-model="sbhd.JTWFDWMC" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="纠正违法通知书文号">
                      <el-tooltip class="item" effect="light" :content="sbhd.JZWFTZSWH" :disabled="sbhd.JZWFTZSWH == null" placement="bottom-start">
                        <el-input v-model="sbhd.JZWFTZSWH" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="法院纠正日期">
                      <el-tooltip class="item" effect="light" :content="sbhd.FYJZRQ" :disabled="sbhd.FYJZRQ == null" placement="bottom-start">
                        <el-input v-model="sbhd.FYJZRQ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="书面提出纠正日期">
                      <el-tooltip class="item" effect="light" :content="sbhd.SMTCJZRQ" :disabled="sbhd.SMTCJZRQ == null" placement="bottom-start">
                        <el-input v-model="sbhd.SMTCJZRQ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="审判活动违法情形">
                      <el-tooltip class="item" effect="light" :content="sbhd.SPHDWFQX" :disabled="sbhd.SPHDWFQX == null" placement="bottom-start">
                        <el-input v-model="sbhd.SPHDWFQX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
            <el-tab-pane label="线索移交情况" name="XSTJ">
              <el-form ref="xsyj" :model="xsyj" label-width="200px">
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="序号">
                      <el-tooltip class="item" effect="light" :content="xsyj.XH" :disabled="xsyj.XH == null" placement="bottom-start">
                        <el-input v-model="xsyj.XH" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="线索涉嫌罪名">
                      <el-tooltip class="item" effect="light" :content="xsyj.XSSXAY" :disabled="xsyj.XSSXAY == null" placement="bottom-start">
                        <el-input v-model="xsyj.XSSXAY" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="移送何侦（调）查机关">
                      <el-tooltip class="item" effect="light" :content="xsyj.YSHZZBM" :disabled="xsyj.YSHZZBM == null" placement="bottom-start">
                        <el-input v-model="xsyj.YSHZZBM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="侦（调）查机关线索处理结果">
                      <el-tooltip class="item" effect="light" :content="xsyj.ZZBMXSCLJG" :disabled="xsyj.ZZBMXSCLJG == null" placement="bottom-start">
                        <el-input v-model="xsyj.ZZBMXSCLJG" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="移送公益诉讼线索日期">
                      <el-tooltip class="item" effect="light" :content="xsyj.YSGYSSXSRQ_DATE" :disabled="xsyj.YSGYSSXSRQ_DATE == null" placement="bottom-start">
                        <el-input v-model="xsyj.YSGYSSXSRQ_DATE" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="移交犯罪线索日期">
                      <el-tooltip class="item" effect="light" :content="xsyj.YJZWFZXSRQ" :disabled="xsyj.YJZWFZXSRQ == null" placement="bottom-start">
                        <el-input v-model="xsyj.YJZWFZXSRQ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="线索涉嫌其他罪名">
                      <el-tooltip class="item" effect="light" :content="xsyj.XSSXQTAY" :disabled="xsyj.XSSXQTAY == null" placement="bottom-start">
                        <el-input v-model="xsyj.XSSXQTAY" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="侦（调）查机关线索处理日期">
                      <el-tooltip class="item" effect="light" :content="xsyj.ZZBMXSCLRQ" :disabled="xsyj.ZZBMXSCLRQ == null" placement="bottom-start">
                        <el-input v-model="xsyj.ZZBMXSCLRQ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="已立案犯罪嫌疑人">
                      <el-tooltip class="item" effect="light" :content="xsyj.YLAFZXYRXM" :disabled="xsyj.YLAFZXYRXM == null" placement="bottom-start">
                        <el-input v-model="xsyj.YLAFZXYRXM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="侦（调）查机关线索处理日期">
                      <el-tooltip class="item" effect="light" :content="xsyj.YSGYSSXSSJSDGJZQX" :disabled="xsyj.YSGYSSXSSJSDGJZQX == null" placement="bottom-start">
                        <el-input v-model="xsyj.YSGYSSXSSJSDGJZQX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>

        <el-tab-pane label="犯罪嫌疑人/单位" name="Suspect">
          <el-tabs v-model="suspectName" @tab-click="handleSuspectClick">
            <el-tab-pane v-for="(tab,index) in suspectCount" :key="index" :name="tab.ID" :label="tab.NAME">
              <suspect ref="suspectRef" :bhrId="bhrId" :folderId="folderId"></suspect>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>

        <el-tab-pane label="被害人/单位" name="Victim">
          <el-tabs v-model="victimName" @tab-click="handleVictimClick">
            <el-tab-pane v-for="(tab,index) in victimCount" :key="index" :name="tab.ID" :label="tab.NAME">
              <el-form ref="victimData" :model="victimData" label-width="200px">
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="部门受案号">
                      <el-tooltip class="item" effect="light" :content="victimData.BMSAH" :disabled="victimData.BMSAH == null"  placement="bottom-start">
                        <el-input  v-model="victimData.BMSAH" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="姓名">
                      <el-tooltip class="item" effect="light" :content="victimData.XM" :disabled="victimData.XM == null"  placement="bottom-start">
                        <el-input  v-model="victimData.XM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="被侵害时年龄">
                      <el-tooltip class="item" effect="light" :content="victimData.BHSNL" :disabled="victimData.BHSNL == null"  placement="bottom-start">
                        <el-input  v-model="victimData.BHSNL" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="住所地">
                      <el-tooltip class="item" effect="light" :content="victimData.ZSD" :disabled="victimData.ZSD == null"  placement="bottom-start">
                        <el-input  v-model="victimData.ZSD" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="工作单位/学校">
                      <el-tooltip class="item" effect="light" :content="victimData.GZDW" :disabled="victimData.GZDW == null"  placement="bottom-start">
                        <el-input  v-model="victimData.GZDW" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="身份">
                      <el-tooltip class="item" effect="light" :content="victimData.SF" :disabled="victimData.SF == null"  placement="bottom-start">
                        <el-input  v-model="victimData.SF" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="法定代理人姓名">
                      <el-tooltip class="item" effect="light" :content="victimData.FDDLR" :disabled="victimData.FDDLR == null"  placement="bottom-start">
                        <el-input  v-model="victimData.FDDLR" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="监护情况">
                      <el-tooltip class="item" effect="light" :content="victimData.JHQK" :disabled="victimData.JHQK == null"  placement="bottom-start">
                        <el-input  v-model="victimData.JHQK" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="受侵害类型">
                      <el-tooltip class="item" effect="light" :content="victimData.SQHLX" :disabled="victimData.SQHLX == null"  placement="bottom-start">
                        <el-input  v-model="victimData.SQHLX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="被害人编号">
                      <el-tooltip class="item" effect="light" :content="victimData.ZRRBM" :disabled="victimData.ZRRBM == null"  placement="bottom-start">
                        <el-input  v-model="victimData.ZRRBM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="曾用名">
                      <el-tooltip class="item" effect="light" :content="victimData.CYM" :disabled="victimData.CYM == null"  placement="bottom-start">
                        <el-input  v-model="victimData.CYM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="国籍">
                      <el-tooltip class="item" effect="light" :content="victimData.ZSDXXDZ" :disabled="victimData.ZSDXXDZ == null"  placement="bottom-start">
                        <el-input  v-model="victimData.ZSDXXDZ" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="工作单位/学校所在地">
                      <el-tooltip class="item" effect="light" :content="victimData.GZDWSZD_DM" :disabled="victimData.GZDWSZD_DM == null"  placement="bottom-start">
                        <el-input  v-model="victimData.GZDWSZD_DM" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="受教育状况">
                      <el-tooltip class="item" effect="light" :content="victimData.SJYZK" :disabled="victimData.SJYZK == null"  placement="bottom-start">
                        <el-input  v-model="victimData.SJYZK" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="特殊群体">
                      <el-tooltip class="item" effect="light" :content="victimData.TSQT" :disabled="victimData.TSQT == null"  placement="bottom-start">
                        <el-input  v-model="victimData.TSQT" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="被害人与犯罪嫌疑人关系">
                      <el-tooltip class="item" effect="light" :content="victimData.BHRYFZXYRGX" :disabled="victimData.BHRYFZXYRGX == null"  placement="bottom-start">
                        <el-input  v-model="victimData.BHRYFZXYRGX" disabled/>
                      </el-tooltip>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>

        <el-tab-pane label="备考表" name="Preparation">
          <el-form ref="preparation" :model="preparation" label-width="120px">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="整理人">
                  <el-tooltip class="item" effect="light" :content="preparation.ZLR" :disabled="preparation.ZLR == null" placement="bottom-start">
                    <el-input v-model="preparation.ZLR" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查人">
                  <el-tooltip class="item" effect="light" :content="preparation.JCR" :disabled="preparation.JCR == null" placement="bottom-start">
                    <el-input v-model="preparation.JCR" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="整理日期">
                  <el-tooltip class="item" effect="light" :content="preparation.ZLRQ" :disabled="preparation.ZLRQ == null" placement="bottom-start">
                    <el-input v-model="preparation.ZLRQ" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="检查日期">
                  <el-tooltip class="item" effect="light" :content="preparation.JCRQ" :disabled="preparation.JCRQ == null" placement="bottom-start">
                    <el-input v-model="preparation.JCRQ" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="卷内说明">
                  <el-tooltip class="item" effect="light" :content="preparation.JNSM" :disabled="preparation.JNSM == null" placement="bottom-start">
                    <el-input v-model="preparation.JNSM" disabled/>
                  </el-tooltip>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </el-tab-pane>

        <el-tab-pane label="管理内容" name="Manage">
          <el-tabs v-model="manageName" @tab-click="handleManageClick">
            <el-tab-pane v-for="(tab,index) in manageCount" :key="index" :name="tab.VALUE" :label="tab.NAME">
              <ManagementContent ref="manageRef" :folderId="folderId" :manageName="manageName"></ManagementContent>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>
      </el-tabs>

      <el-dialog title="预览" :visible.sync="open" width="45%" append-to-body :before-close="close">
        <div style="width:100%;margin:0 auto">
          <!-- <pdfDemo :url="pdfUrl" operate="online"></pdfDemo> -->
          <pdfDemo :url="pdfUrl"  v-if="pdfUrl"></pdfDemo>
        </div>
      </el-dialog>
    </el-dialog>
</template>

<script>
// import {getInfomation} from "@/api/archive/digitalizeReceive/archiveReception";
import ExamineProsecute from "@/views/archive/digitalizeReceive/archiveReception/examineProsecute";
import Suspect from "@/views/archive/digitalizeReceive/archiveReception/suspect";
import ManagementContent from "@/views/archive/digitalizeReceive/archiveReception/managementContent";
import { getInfomation } from "@/api/archive/fileCollection/onlineReception";
// import pdfDemo from "@/components/componentsPdf";
import pdfDemo from '@/components/componentsPdf/index1.vue'
import axios from "axios";
import {getToken} from "@/utils/auth";

export default {
  name: "informationDetail",
  components: {ManagementContent, Suspect, ExamineProsecute, pdfDemo},
  props: ["info"],
  data() {
    return {
      activeName: 'Header',
      folderId: '',
      bhrId: '',
      categoryId: '',
      // 当事人信息
      partyName: '',
      // 案件信息的标签页
      caseName: 'SCQS',
      scqsName: '1',
      sbhd: {}, // 审判活动监督情况
      xsyj: {}, // 线索移交情况

      // 犯罪嫌疑人/单位标签页
      suspectName: '',
      suspectCount: [],

      // 被害人/单位标签页
      victimName: '',
      victimCount: [],
      victimData: {},

      // 管理内容标签页
      manageName: '',
      manageCount: [
        {VALUE: 'DZWJ', NAME: '电子文件归档登记表'},
        {VALUE: 'GDYJ', NAME: '归档移交凭证'},
        {VALUE: 'XGSP', NAME: '已归档案件修改审批表'},
      ],

      // 包头数据表单
      header: {},
      // 当事人信息
      party: [],
      // 备考表信息
      preparation: {},
      pdfUrl: "",
      open: false,
    }
  },
  methods: {
    init(val, categoryId) {
      this.activeName = 'Header'
      this.folderId = val
      this.categoryId = categoryId
      this.form = {
        folderId: val,
        msg: 'DATAHEAD',
        bhrId: 'null'
      }
      this.getInfo(this.form)
      this.$refs.scqsRef.activeName = null
    },
    // 点击标签页
    handleClick(tab, event) {
      if(tab.name == 'Header') { // 信息包头
        this.form = {
          folderId: this.folderId,
          msg: 'DATAHEAD',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if(tab.name == 'Party') { // 当事人信息
        this.form = {
          folderId: this.folderId,
          msg: 'dsrxx',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if(tab.name == 'Case') { // 案件信息
        this.caseName = 'SCQS'
      } else if(tab.name == 'Suspect') { // 犯罪嫌疑人/单位
        this.form = {
          folderId: this.folderId,
          msg: 'akfzxyr',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if(tab.name == 'Victim') { // 被害人/单位
        this.form = {
          folderId: this.folderId,
          msg: 'akbhr',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if(tab.name == 'Preparation') { // 备考表
        this.form = {
          folderId: this.folderId,
          msg: 'bkb',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if(tab.name == 'Manage') { // 管理内容
        this.manageName = this.manageCount[0].VALUE
        // this.$refs.manageRef.resetContentName();
        this.$refs.manageRef.manageData = {}
      }
    },
    // 案件信息标签页
    handleCaseClick(tab, event) {
      if(tab.name == 'SCQS') {

      } else if (tab.name == 'SBHD') {
        this.form = {
          folderId: this.folderId,
          msg: 'AKSP',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      } else if (tab.name == 'XSTJ') {
        this.form = {
          folderId: this.folderId,
          msg: 'AKXS',
          bhrId: 'null'
        }
        this.getInfo(this.form)
      }
    },
    // 犯罪嫌疑人/单位标签页
    handleSuspectClick(tab, event) {
      this.$refs.suspectRef[0].suspectCountName = null
      this.$refs.suspectRef[1].suspectCountName = null
      this.bhrId = tab.name
    },
    // 被害人/单位标签页
    handleVictimClick(tab, event) {
      this.bhrId = tab.name
      this.form = {
        folderId: this.folderId,
        msg: 'akbhrxx',
        bhrId: tab.name
      }
      getInfomation(this.form).then(response=>{
        this.victimData = {}
        if(response.data.length != 0) {
          this.victimData = response.data[0]
        }
      })
    },
    // 管理内容标签页
    handleManageClick(tab, event) {
      for (let i = 0; i < this.$refs.manageRef.length; i++) {
        this.$refs.manageRef[i].manageCount = {}
        this.$refs.manageRef[i].contentName = null
      }
    },

    getInfo(form) {
      getInfomation(form).then(response=>{
        console.log(response)
        if(this.activeName == 'Header') {
          this.header = {}
          if(response.data.length != 0) {
            this.header = response.data[0]
          }
        } else if (this.activeName == 'Party') {
          this.party = response.data
        } else if (this.activeName == 'Suspect') {
          this.suspectCount = response.data
          if(response.data.length != 0) {
            this.suspectName = response.data[0].ID
            this.bhrId = response.data[0].ID
          }
        } else if (this.activeName == 'Victim') {
          this.victimCount = response.data
          if(response.data.length != 0) {
            this.victimName = response.data[0].ID
            this.bhrId = response.data[0].ID
            this.form = {
              folderId: this.folderId,
              msg: 'akbhrxx',
              bhrId: this.bhrId
            }
            getInfomation(this.form).then(response=>{
              this.victimData = {}
              if(response.data.length != 0) {
                this.victimData = response.data[0]
              }
            })
          }
        } else if (this.activeName == 'Preparation') {
          this.preparation = {}
          if(response.data.length != 0) {
            this.preparation = response.data[0]
          }
        }

        if (this.caseName == 'SBHD') {
          this.sbhd = {}
          if(response.data.length != 0) {
            this.sbhd = response.data[0]
          }
        } else if (this.caseName == 'XSTJ') {
          this.xsyj = {}
          if(response.data.length != 0) {
            this.xsyj = response.data[0]
          }
        }
      })
    },
    closeDelDialog() {
      this.header = {}
      if(this.$refs.scqsRef != undefined) {
        this.$refs.scqsRef.basicData = {}
      }
      if(this.$refs.suspectRef != undefined) {
        this.$refs.suspectRef[0].suspectData = {}
        this.$refs.suspectRef[1].suspectData = {}
        this.$refs.suspectRef[0].suspectCountName = null
        this.$refs.suspectRef[1].suspectCountName = null
      }
      this.sbhd = {}
      this.xsyj = {}
      this.victimData = {}
      this.preparation = {}
      if(this.$refs.manageRef != undefined) {
        for (let i = 0; i < this.$refs.manageRef.length; i++) {
          this.$refs.manageRef[i].manageCount = {}
          this.$refs.manageRef[i].contentName = null
        }
      }
      this.$emit('infoCancelTap')
    },
    // 点击预览
    // 1：备考表 2：电子文件归档登记表 3：卷内目录 4：卷皮
    onInfoTap(infotype) {
      console.log(infotype)
      axios({
        method: 'POST',
        url: process.env.VUE_APP_BASE_API + `/archive/guidang/viewPdf`,
        params: {
          type: infotype,
          folderId: this.folderId,
          categoryId: this.categoryId
        },
        headers: {
          Authorization: "Bearer " + getToken()
        },
        responseType: 'blob' // 更改responseType类型为 blob
      }).then(res => {
        this.open = true
  
        const blob = new Blob([res.data], { type: 'application/pdf;charset-UTF-8' });
              console.log(blob.size, "+++++++++++++++++++++++++")
              // this.$nextTick(res => {
              this.pdfUrl = blob

              // })
       
      }).catch(err => {
        console.log(err)
      })





    },
    close() {
      this.open = false
    }
  }
}
</script>

<style lang="less" scoped>
.headerInfoButton {
  position: absolute;
  top: 16px;
  right: 60px;
}
</style>
